<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>用户信息 - 招生报名系统</title>
<script src="css/tailwindcss.css"></script>
</head>
<body class="bg-gray-50 min-h-screen flex items-center justify-center py-8">

<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {

ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsUser user = new ZsUser();
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");
}
ZsUserStatus userStatus = smanager.getDataByUser(user);
%>
    <div class="w-full max-w-md mx-auto px-4">
        <div class="bg-white rounded-xl shadow-lg border border-gray-100 p-8">
            <div class="text-center mb-8">
                <h1 class="text-2xl font-bold text-gray-800 mb-2">用户信息管理</h1>
                <p class="text-gray-600">修改您的个人注册信息</p>
            </div>

            <form id="ff" name="add" role="form" class="form-horizontal" action="" method="post">
                <div class="space-y-6">
                    <div>
                        <label for="usIdcard" class="block text-sm font-medium text-gray-700 mb-2">
                            身份证号 <span class="text-red-500">*</span>
                        </label>
                        <input id="usIdcard" name="usIdcard" type="text" class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed" placeholder="身份证号" value="<%=user.getUsIdcard() %>" readonly/>
                        <p class="text-sm text-gray-500 mt-1">*请仔细填写，用于账号登录</p>
                    </div>

                    <div>
                        <label for="usBmxh" class="block text-sm font-medium text-gray-700 mb-2">
                            高考序号 <span class="text-red-500">*</span>
                        </label>
                        <input id="usBmxh" name="usBmxh" type="text" class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed" placeholder="高考序号" value="<%=user.getUsBmxh() %>" readonly/>
                    </div>

                    <div>
                        <label for="usPassword" class="block text-sm font-medium text-gray-700 mb-2">
                            密码
                        </label>
                        <input id="usPassword" name="usPassword" type="password" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200" placeholder="新密码" required data-msg-required="不能为空" data-msg-psw="8-20位的大写字母，小写字母，数字和特殊字符4种组合" minlength="8" data-msg-minlength="请输入最小8位" value="<%=user.getUsPassword() %>"/>
                        <p class="text-sm text-red-500 mt-1">*8-20位的大写字母，小写字母，数字和特殊字符4种组合</p>
                    </div>

                    <div>
                        <label for="rusPassword" class="block text-sm font-medium text-gray-700 mb-2">
                            确认密码
                        </label>
                        <input id="rusPassword" name="rusPassword" type="password" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200" placeholder="确认新密码" equalTo="#usPassword" value="<%=user.getUsPassword() %>"/>
                    </div>

                    <div>
                        <label for="usName" class="block text-sm font-medium text-gray-700 mb-2">
                            真实姓名 <span class="text-red-500">*</span>
                        </label>
                        <input id="usName" name="usName" type="text" class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed" required placeholder="姓名" value="<%=user.getUsName() %>" readonly/>
                        <p class="text-sm text-gray-500 mt-1">*请填写真实姓名</p>
                    </div>

                    <div>
                        <label for="usMobile" class="block text-sm font-medium text-gray-700 mb-2">
                            手机号码 <span class="text-red-500">*</span>
                        </label>
                        <input id="usMobile" name="usMobile" type="text" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200" placeholder="手机号" required data-rule-mobile="true" data-msg-required="请输入手机号" data-msg-mobile="请输入正确格式" value="<%=user.getUsMobile() %>"  <%if(session.getAttribute("admin")==null)out.print("readonly"); %>/>
                    </div>

                    <input id="addTime" name="addTime" type="text" class="dfinput" value="<%=user.getAddTime()%>" style="display:none;"/>
                    <input id="editTime" name="editTime" type="text" class="dfinput" value="<%=user.getEditTime()%>" style="display:none;"/>
                    <input id="loginTime" name="loginTime" type="text" class="dfinput" value="<%=user.getLoginTime()%>" style="display:none;"/>
                    <input id="usId" name="usId" type="text" class="dfinput" value="<%=user.getUsId() %>" style="display:none;"/>
                    <input id="usNo" name="usNo" type="text" class="dfinput" value="<%=user.getUsNo() %>" style="display:none;"/>
                    <input id="usActive" name="usActive" type="text" class="dfinput" value="<%=user.getUsActive() %>" style="display:none;"/>

                    <div class="pt-4">
                        <%if(Status.SENDSTATUS_NULL.getStatus().equals(userStatus.getSendStatus()) || Status.SENDSTATUS_NO.getStatus().equals(userStatus.getSendStatus()) || session.getAttribute("admin")!=null){ %>
                        <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-4 rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
                            确认保存
                        </button>
                        <%} else {%>
                        <button type="submit" class="w-full bg-gray-300 text-white font-medium py-3 px-4 rounded-lg cursor-not-allowed">
                            已提交
                        </button>
                        <%} %>
                    </div>
                </div>
            </form>
        </div>
    </div>

<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script>


		<script type="text/javascript">
		var updateOneAction = '../zsUserUpdate.action?randnum='+Math.floor(Math.random()*1000000);
		var loactionurl = 'zs_user_edit.jsp';

		$(function(){
		    //jquery.validate
			$("#ff").validate({
				submitHandler: function() {
					//验证通过后 的js代码写在这里
					submitForm();
				}
			})
		})
		</script>
<%} %>
</body>

</html>